package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.bo.AccountGoodsBO;
import com.cskaoyan.bean.bo.AccountOrderBO;
import com.cskaoyan.bean.bo.AccountUserBO;
import com.cskaoyan.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Tang_XueCheng
 * @description 统计报表模块
 * @since 2022/04/06 22:08
 */
@RestController
@RequestMapping("admin/stat")
public class AccountController {

    @Autowired
    AccountService accountService;
    // 用户统计：/admin/config/mall ----------------------------------
    /**
    *@Author:TangXueCheng
    *@Description:
    *@Param:
    *@Date:  {
     * 		"columns": ["day", "users"],
     * 		"rows": [{
     * 			"day": "2019-04-20",
     * 			"users": 3}]
     * 		}
    */
    @RequestMapping("user")
    public BaseRespVo user() {

        AccountUserBO accountUserBO = accountService.queryUser();
        return  BaseRespVo.ok(accountUserBO);
    }

    // 订单统计：/admin/config/mall ----------------------------------
   /**
   *@Author:TangXueCheng
   *@Description:
   *@Param:
   *@Date:  {
    * 		"columns": ["day", "orders", "customers", "amount", "pcr"],
    * 		"rows": [{
    * 			"amount": 67.00,
    * 			"orders": 1,
    * 			"customers": 1,
    * 			"day": "2022-01-06",
    * 			"pcr": 67.00
    *                }]
   */
    @RequestMapping("order")
    public BaseRespVo order() {
         AccountOrderBO accountOrderBO = accountService.queryOrder();
        return BaseRespVo.ok(accountOrderBO);
    }
    /**
    *@Author:TangXueCheng
    *@Description:
    *@Param:
    *@Date: "data": {
     * 		"columns": ["day", "orders", "products", "amount"],
     * 		"rows": [{
     * 			"amount": 297.00,
     * 			"orders": 3,
     * 			"day": "2022-01-06",
     * 			"products": 3
     *                }]
    */
    // 商品统计：/admin/config/mall ----------------------------------

    @RequestMapping("goods")
    public BaseRespVo goods() {
        AccountGoodsBO accountGoodsBO = accountService.queryGoods();
        return BaseRespVo.ok(accountGoodsBO);
    }
}
